package com.jungle.sp.daily.feature.d6_sequenced_collection;

import java.util.LinkedHashMap;
import java.util.Map;
import java.util.SequencedMap;

/**
 * @author Jungle
 * @create 2024-07-14 8:04
 */
public class Demo3 {
    public static void main(String[] args) {
        SequencedMap<String, Integer> map = new LinkedHashMap<>();
        // SequencedMap<String, Integer> map = newreeap > ();
        for (int i = 0; i < 10; i++) {
            map.put("key" + i, i);
            //向Map中的第一个位置再添加一个键值对:key11:11
        }
        for (String key : map.keySet()) {
            System.out.println(STR."\{key}=\{map.get(key)}");
        }
        Map.Entry<String, Integer> entry = map.firstEntry();
        System.out.println(entry);


        map.pollLastEntry();
        System.out.println(map);
    }
}


